package cn.hhchat.wp.entity;

import javax.persistence.*;
import javax.persistence.Entity;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.*;
import org.hibernate.annotations.CascadeType;

import java.util.Date;


/**
 * Created this one by HMH on 2017/10/22.
 */

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "subscribe_relation_entity")
public class SubscribeRelationEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ManyToOne
    @Cascade(CascadeType.SAVE_UPDATE)
    private GroupEntity group;

    @ManyToOne
    @Cascade(CascadeType.SAVE_UPDATE)
    private UserEntity user;

    @CreationTimestamp
    private Date subscribeTime;

    @UpdateTimestamp
    private Date updateTime;

}
